package com.hxs.colorfultest2.service.impl;

import com.hxs.colorfultest2.dao.FactoryDao;
import com.hxs.colorfultest2.domain.Factory;
import com.hxs.colorfultest2.service.FactoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class FactoryServiceImpl implements FactoryService {
    @Autowired
    FactoryDao factoryDao;
    /*增加厂商*/
    @Override
    public void addFactory(Factory factory) {
       factoryDao.addFactory(factory);
    }

    /*更新厂商*/
    @Override
    public void updateFactory(Factory factory) {
        factoryDao.updateFactory(factory);
    }

    /*获取所有厂商*/
    @Override
    public List<Factory> getAllFactory() {
        return factoryDao.getAllFactory();
    }

    /*获取分页厂商数量*/
    @Override
    public int getFactoryByTotal() {
        return factoryDao.getFactoryByTotal();
    }

    /*获取每页厂商*/
    @Override
    public List<Factory> getFactoryByPage(Map<String, Object> paramMap) {
        return factoryDao.getFactoryByPage(paramMap);
    }

    /*检测重名*/
    @Override
    public boolean checkName(String name) {
        return factoryDao.checkName(name);
    }

    /*删除厂商*/
    @Override
    public void deleteFactory(String name) {
        factoryDao.deleteFactory(name);
    }

    /*根据名称查找厂商*/
    @Override
    public Factory getFactoryByName(String name) {
        return factoryDao.getFactoryByName(name);
    }

    @Override
    /*根据ID查找厂商*/
    public Factory getFactoryByID(int id) {
        return factoryDao.getFactoryByID(id);
    }

    @Override
    public List<Factory> getDeleteFactory() {
        return factoryDao.getDeleteFactory();
    }
}
